var param = JSON.parse(localStorage.getItem('param'));
var evaUserId;
var replyUserId;
console.log(param);
$(function(){
	init();
	initButton();
});
//初始化页面
function init(){
	
}
//初始化绑定事件
function initButton(){
	$('.fr').on('click',function(){
		var msg = $('.comment-con').val();
		if(!msg){
			alert("请输入评论");
		}else{
			if(param.evaType=='0'){
				evaUserId = localStorage.getItem('userid');
				replyUserId = '';
			}else{
				evaUserId = localStorage.getItem('userid');
				replyUserId = param.replyUserId;
			}
			
			
			$.ajax({
				type : "post",
				url : server_url
						+ 'rest/eva/saveEva.do?ran=' + Math.random(),
				dataType : 'json',
				async : true,
				data : {
					token : token,
					evaUserId:evaUserId,
					replyUserId:replyUserId,
					msg:msg,
					commentId:param.commentId,
					evaType:param.evaType
				},
				success : function(result) {
					localStorage.setItem('orderId',param.orderId);
					window.location = server_url + "allComment.do";
				}
			});
		}
	});
}